package net.lzzy.practices.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Date;

/**
 *
 */
@Entity
@Getter
@Setter
public class Applicant extends BaseEntity {

       @Transient
       public static final int TYPE_APPLYING = 0;
       @Transient
       public  static  final  int TYPE_APPROVED = 1;
       @Transient
       public  static  final  int TYPE_DECLINED = 2;
       @ManyToOne
       private  User student;
       @ManyToOne
       private  Course course;
       private  int status;

       @Temporal(TemporalType.TIMESTAMP)
       private Date applyTime;


       public Applicant() {
             applyTime = new Date();
       }

       @JsonBackReference
       public  Course getCourse(){
              return  course;
       }

       @JsonBackReference
       public  User getStudents(){
              return  student;
       }
}
